//
//  AIBaseTabBarVC.m
//  AICases
//
//  Created by 陶磊 on 2020/9/27.
//  Copyright © 2020 陶磊. All rights reserved.
//

#import "AIBaseTabBarVC.h"

@interface AIBaseTabBarVC ()

@end

@implementation AIBaseTabBarVC

- (void)viewDidLoad {
    [super viewDidLoad];


    UINavigationController *localHospitalNavi = [[UIStoryboard storyboardWithName:@"AILocalHospital" bundle:nil] instantiateViewControllerWithIdentifier:@"localHospitalNavi"];
    //    [self childControllers:homePageNavi imageName:@"homePage_default" selectedImageName:@"homePage_selected"];
    //    homePageNavi.tabBarItem
    [localHospitalNavi.tabBarItem setTitle:@"本地医院"];
    
    UINavigationController *myCollectionNavi = [[UIStoryboard storyboardWithName:@"AIMyCollection" bundle:nil] instantiateViewControllerWithIdentifier:@"myCollectionNavi"];
    //    [self childControllers:maintenanceavi imageName:@"found_default" selectedImageName:@"found_selected"];
    [myCollectionNavi.tabBarItem setTitle:@"我的收藏"];
    
    UINavigationController *cooperationUnitNavi = [[UIStoryboard storyboardWithName:@"AICooperationUnit" bundle:nil] instantiateViewControllerWithIdentifier:@"cooperationUnitNavi"];
    //    [self childControllers:cartNavi imageName:@"dynamic_default" selectedImageName:@"dynamic_selected"];
    [cooperationUnitNavi.tabBarItem setTitle:@"合作单位"];
    
    
    UINavigationController *medicalResourcesNavi = [[UIStoryboard storyboardWithName:@"AIMedicalResources" bundle:nil] instantiateViewControllerWithIdentifier:@"medicalResourcesNavi"];
    //    [self childControllers:cartNavi imageName:@"dynamic_default" selectedImageName:@"dynamic_selected"];
    [medicalResourcesNavi.tabBarItem setTitle:@"名医资源"];
    
    UINavigationController *personalCenterNavi = [[UIStoryboard storyboardWithName:@"AIPersonalCenter" bundle:nil] instantiateViewControllerWithIdentifier:@"personalCenterNavi"];
    //    [self childControllers:cartNavi imageName:@"dynamic_default" selectedImageName:@"dynamic_selected"];
    [personalCenterNavi.tabBarItem setTitle:@"个人中心"];
    
    
    
    
    [self addChildViewController:localHospitalNavi];
    [self addChildViewController:myCollectionNavi];
    [self addChildViewController:cooperationUnitNavi];
    [self addChildViewController:medicalResourcesNavi];
    [self addChildViewController:personalCenterNavi];

    //    [[UIBarButtonItem appearance] setBackButtonTitlePositionAdjustment:UIOffsetMake(0, -500)
    //    forBarMetrics:UIBarMetricsDefault];
    [[UIBarButtonItem appearance] setTitleTextAttributes:@{NSFontAttributeName: [UIFont systemFontOfSize:0.1], NSForegroundColorAttributeName: [UIColor clearColor]} forState:UIControlStateNormal];

}



- (void)childControllers:(UIViewController *)childVC imageName:(NSString *)imageName selectedImageName:(NSString *)selectImageName
{
    childVC.tabBarItem.image = [[UIImage imageNamed:imageName]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];//tabBarItem图片保持原始模式
    childVC.tabBarItem.selectedImage = [[UIImage imageNamed:selectImageName]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
//    NSDictionary *childDicSelect = [NSDictionary dictionaryWithObject:[UIColor base_blue] forKey:NSForegroundColorAttributeName];
//    NSDictionary *childDicDefault = [NSDictionary dictionaryWithObject:[UIColor blackColor] forKey:NSForegroundColorAttributeName];
    
//    [childVC.tabBarItem setTitleTextAttributes:childDicDefault forState:UIControlStateNormal];
//    [childVC.tabBarItem setTitleTextAttributes:childDicSelect forState:UIControlStateSelected];

}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
